// Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
// This source file is part of the Cangjie project, licensed under Apache-2.0
// with Runtime Library Exception.
//
// See https://cangjie-lang.cn/pages/LICENSE for license information.

#ifndef PLATFORM_TEMPDIRECTORY_H
#define PLATFORM_TEMPDIRECTORY_H

#include "Path.h"

namespace Platform {

class TempDirectory {
public:
    TempDirectory();
    ~TempDirectory();

    TempDirectory(const TempDirectory&) = delete;
    TempDirectory& operator=(const TempDirectory&) = delete;

    TempDirectory(TempDirectory&& other) noexcept;
    TempDirectory& operator=(TempDirectory&& other) noexcept;

    static Path GetSystemTempDir();

    [[nodiscard]] const Path &GetPath() const;

    [[nodiscard]] Path GenerateUniqueFilePath() const;

    friend Path operator/(const TempDirectory& dir, const Path& sub);
    friend Path operator/(const TempDirectory& dir, const std::string &sub);

private:
    Path path;
};

} // Platform

#endif // PLATFORM_TEMPDIRECTORY_H
